package com.yuexun.dhdoctor.module.meeting.ui;

import android.widget.ListView;
import android.widget.TextView;


import com.yuexun.dhdoctor.R;
import com.yuexun.dhdoctor.base.BaseEntity;
import com.yuexun.dhdoctor.base.BaseKJActivity;
import com.yuexun.dhdoctor.config.AppConfig;
import com.yuexun.dhdoctor.module.meeting.adapter.MeetingSignAdapter;
import com.yuexun.dhdoctor.module.meeting.bean.MeetingSignData;
import com.yuexun.dhdoctor.module.meeting.model.impl.MeetingModel;
import com.yuexun.dhdoctor.module.meeting.presenter.impl.MeetingSignPresenter;
import com.yuexun.dhdoctor.module.meeting.ui.view.IMeetingSignView;

import org.kymjs.kjframe.ui.ViewInject;
import org.kymjs.kjframe.utils.PreferenceHelper;

import java.util.HashMap;
import java.util.Map;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/4/10 0010.
 */

public class Act_Meeting_Sign extends BaseKJActivity implements IMeetingSignView {

    @Bind(R.id.title)
    TextView tvTitle;
    @Bind(R.id.signList)
    ListView signList;

    private String meetingId;
    MeetingSignPresenter presenter;
    MeetingSignAdapter signAdapter;

    @Override
    public void setRootView() {
        super.setRootView();
        setContentView(R.layout.act_meetingsign);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();

        meetingId = getIntent().getExtras().getString("meetingId");
        presenter = new MeetingSignPresenter(new MeetingModel(), this);

        Map<String, String> params = new HashMap<>();
        params.put("sessionUuid", PreferenceHelper.readString(aty, AppConfig.USER_INFO, AppConfig.SESSION_ID));
        params.put("meetingId", meetingId);
        presenter.getMeetingSign(params);
    }

    @Override
    public void showMeetingSignList(BaseEntity<MeetingSignData> list) {
        if(list.getStatus().equals("200")){
            signAdapter = new MeetingSignAdapter(signList, list.getDatas(), R.layout.item_meeting_sign);
            signList.setAdapter(signAdapter);
        }else{
            ViewInject.toast("获取签到记录失败");
        }
    }

    @OnClick(R.id.back)
    public void onClick() {
        finish();
    }
}
